//
//  ResidueView.m
//  phmall
//
//  Created by admin on 2017/10/10.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "ResidueView.h"

@implementation ResidueView

-(instancetype)init{
    if (self=[super init]) {
        UIImageView *back=[[UIImageView alloc]init];
        [self addSubview:back];
        back.image=[UIImage imageNamed:@"秒杀进度条"];
        [back mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self);
        }];
        
        UIView *red=[[UIView alloc]init];
        [self addSubview:red];
        red.backgroundColor=[UIColor colorWithHexString:@"#ff8200"];
        ViewBorderRadius(red, 6, 0, [UIColor clearColor]);
        [red mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(back);
            make.centerY.equalTo(back);
            make.height.equalTo(back);
            make.width.equalTo(back.mas_width).multipliedBy(0.9);
        }];
        
        UILabel *number=[[UILabel alloc]init];
        number.text=[NSString stringWithFormat:@"%@%@",Localized(@"剩余"),@"200"];
        number.textColor=[UIColor whiteColor];
        number.font=[UIFont systemFontOfSize:10];
        number.textAlignment=NSTextAlignmentCenter;
        [self addSubview:number];
        [number mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self);
        }];
    }
    return self;
}

@end
